home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / MacWindows.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  65.3 KB  |  1,844 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        MacWindows.h
  3.  
  4.      Contains:    Window Manager Interfaces
  5.  
  6.      Version:    Technology:    Mac OS 9
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1997-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __MACWINDOWS__
  18. #define __MACWINDOWS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __ALIASES__
  25.     #include <Aliases.h>
  26. #endif
  27.  
  28. #ifndef __APPLEEVENTS__
  29.     #include <AppleEvents.h>
  30. #endif
  31.  
  32. #ifndef __COLLECTIONS__
  33.     #include <Collections.h>
  34. #endif
  35.  
  36. #ifndef __DRAG__
  37.     #include <Drag.h>
  38. #endif
  39.  
  40. #ifndef __EVENTS__
  41.     #include <Events.h>
  42. #endif
  43.  
  44. #ifndef __MENUS__
  45.     #include <Menus.h>
  46. #endif
  47.  
  48. #ifndef __MIXEDMODE__
  49.     #include <MixedMode.h>
  50. #endif
  51.  
  52. #ifndef __QDOFFSCREEN__
  53.     #include <QDOffscreen.h>
  54. #endif
  55.  
  56. #ifndef __QUICKDRAW__
  57.     #include <Quickdraw.h>
  58. #endif
  59.  
  60. #ifndef __TEXTCOMMON__
  61.     #include <TextCommon.h>
  62. #endif
  63.  
  64. #ifndef __ICONS__
  65.     #include <Icons.h>
  66. #endif
  67.  
  68. #ifndef __MACERRORS__
  69.     #include <MacErrors.h>
  70. #endif
  71.  
  72.  
  73.  
  74. #if PRAGMA_ONCE
  75. #pragma once
  76. #endif
  77.  
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81.  
  82. #if PRAGMA_IMPORT
  83. #pragma import on
  84. #endif
  85.  
  86. #if PRAGMA_STRUCT_ALIGN
  87.     #pragma options align=mac68k
  88. #elif PRAGMA_STRUCT_PACKPUSH
  89.     #pragma pack(push, 2)
  90. #elif PRAGMA_STRUCT_PACK
  91.     #pragma pack(2)
  92. #endif
  93.  
  94. /*                                                                                                         */
  95. /* Current documentation for the Mac OS Window Manager is available on the web:                            */
  96. /*    <http://developer.apple.com/techpubs/macos8/HumanInterfaceToolbox/WindowManager/windowmanager.html>    */
  97. /*                                                                                                         */
  98. /*--------------------------------------------------------------------------------------*/
  99. /* o Property Types                                                                        */
  100. /*--------------------------------------------------------------------------------------*/
  101. typedef OSType                             PropertyCreator;
  102. typedef OSType                             PropertyTag;
  103. /*--------------------------------------------------------------------------------------*/
  104. /* o Window Classes                                                                     */
  105. /*--------------------------------------------------------------------------------------*/
  106.  
  107. typedef UInt32 WindowClass;
  108. enum {
  109.     kAlertWindowClass            = 1L,                            /* "I need your attention now."*/
  110.     kMovableAlertWindowClass    = 2L,                            /* "I need your attention now, but I'm kind enough to let you switch out of this app to do other things."*/
  111.     kModalWindowClass            = 3L,                            /* system modal, not draggable*/
  112.     kMovableModalWindowClass    = 4L,                            /* application modal, draggable*/
  113.     kFloatingWindowClass        = 5L,                            /* floats above all other application windows*/
  114.     kDocumentWindowClass        = 6L,                            /* document windows*/
  115.     kDesktopWindowClass            = 7L,                            /* desktop window (usually only one of these exists) - OS X only in CarbonLib 1.0*/
  116.     kAllWindowClasses            = 0xFFFFFFFF                    /* for use with GetFrontWindowOfClass, FindWindowOfClass, GetNextWindowOfClass*/
  117. };
  118.  
  119.  
  120. /*--------------------------------------------------------------------------------------*/
  121. /* o Window Attributes                                                                     */
  122. /*--------------------------------------------------------------------------------------*/
  123.  
  124. typedef UInt32                             WindowAttributes;
  125. enum {
  126.     kWindowNoAttributes            = 0L,                            /* no attributes*/
  127.     kWindowCloseBoxAttribute    = (1L << 0),                    /* window has a close box*/
  128.     kWindowHorizontalZoomAttribute = (1L << 1),                    /* window has horizontal zoom box*/
  129.     kWindowVerticalZoomAttribute = (1L << 2),                    /* window has vertical zoom box*/
  130.     kWindowFullZoomAttribute    = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute),
  131.     kWindowCollapseBoxAttribute    = (1L << 3),                    /* window has a collapse box*/
  132.     kWindowResizableAttribute    = (1L << 4),                    /* window is resizable*/
  133.     kWindowSideTitlebarAttribute = (1L << 5),                    /* window wants a titlebar on the side    (floating window class only)*/
  134.     kWindowNoUpdatesAttribute    = (1L << 16),                    /* this window receives no update events*/
  135.     kWindowNoActivatesAttribute    = (1L << 17),                    /* this window receives no activate events*/
  136.     kWindowNoBufferingAttribute    = (1L << 20),                    /* this window is not buffered (Mac OS X only)*/
  137.     kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute),
  138.     kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
  139. };
  140.  
  141. /*--------------------------------------------------------------------------------------*/
  142. /* o Window Definition Type                                                                */
  143. /*--------------------------------------------------------------------------------------*/
  144. enum {
  145.     kWindowDefProcType            = FOUR_CHAR_CODE('WDEF')
  146. };
  147.  
  148. /*--------------------------------------------------------------------------------------*/
  149. /* o Mac OS 7.5 Window Definition Resource IDs                                            */
  150. /*--------------------------------------------------------------------------------------*/
  151. enum {
  152.     kStandardWindowDefinition    = 0,                            /* for document windows and dialogs*/
  153.     kRoundWindowDefinition        = 1,                            /* old da-style window*/
  154.     kFloatingWindowDefinition    = 124                            /* for floating windows*/
  155. };
  156.  
  157. /*--------------------------------------------------------------------------------------*/
  158. /* o Variant Codes                                                                        */
  159. /*--------------------------------------------------------------------------------------*/
  160. enum {
  161.                                                                 /* for use with kStandardWindowDefinition */
  162.     kDocumentWindowVariantCode    = 0,
  163.     kModalDialogVariantCode        = 1,
  164.     kPlainDialogVariantCode        = 2,
  165.     kShadowDialogVariantCode    = 3,
  166.     kMovableModalDialogVariantCode = 5,
  167.     kAlertVariantCode            = 7,
  168.     kMovableAlertVariantCode    = 9,                            /* for use with kFloatingWindowDefinition */
  169.     kSideFloaterVariantCode        = 8
  170. };
  171.  
  172.  
  173. /*--------------------------------------------------------------------------------------*/
  174. /* o DefProc IDs                                                                        */
  175. /*--------------------------------------------------------------------------------------*/
  176. enum {
  177.                                                                 /* classic ids */
  178.     documentProc                = 0,
  179.     dBoxProc                    = 1,
  180.     plainDBox                    = 2,
  181.     altDBoxProc                    = 3,
  182.     noGrowDocProc                = 4,
  183.     movableDBoxProc                = 5,
  184.     zoomDocProc                    = 8,
  185.     zoomNoGrow                    = 12,
  186.     rDocProc                    = 16,                            /* floating window defproc ids */
  187.     floatProc                    = 1985,
  188.     floatGrowProc                = 1987,
  189.     floatZoomProc                = 1989,
  190.     floatZoomGrowProc            = 1991,
  191.     floatSideProc                = 1993,
  192.     floatSideGrowProc            = 1995,
  193.     floatSideZoomProc            = 1997,
  194.     floatSideZoomGrowProc        = 1999
  195. };
  196.  
  197. enum {
  198.                                                                 /* Resource IDs for theme-savvy window defprocs */
  199.     kWindowDocumentDefProcResID    = 64,
  200.     kWindowDialogDefProcResID    = 65,
  201.     kWindowUtilityDefProcResID    = 66,
  202.     kWindowUtilitySideTitleDefProcResID = 67
  203. };
  204.  
  205. enum {
  206.                                                                 /* Proc IDs for theme-savvy windows */
  207.     kWindowDocumentProc            = 1024,
  208.     kWindowGrowDocumentProc        = 1025,
  209.     kWindowVertZoomDocumentProc    = 1026,
  210.     kWindowVertZoomGrowDocumentProc = 1027,
  211.     kWindowHorizZoomDocumentProc = 1028,
  212.     kWindowHorizZoomGrowDocumentProc = 1029,
  213.     kWindowFullZoomDocumentProc    = 1030,
  214.     kWindowFullZoomGrowDocumentProc = 1031
  215. };
  216.  
  217.  
  218. enum {
  219.                                                                 /* Proc IDs for theme-savvy dialogs */
  220.     kWindowPlainDialogProc        = 1040,
  221.     kWindowShadowDialogProc        = 1041,
  222.     kWindowModalDialogProc        = 1042,
  223.     kWindowMovableModalDialogProc = 1043,
  224.     kWindowAlertProc            = 1044,
  225.     kWindowMovableAlertProc        = 1045
  226. };
  227.  
  228.  
  229. enum {
  230.                                                                 /* procIDs available from Mac OS 8.1 (Appearance 1.0.1) forward */
  231.     kWindowMovableModalGrowProc    = 1046
  232. };
  233.  
  234.  
  235. enum {
  236.                                                                 /* Proc IDs for top title bar theme-savvy floating windows */
  237.     kWindowFloatProc            = 1057,
  238.     kWindowFloatGrowProc        = 1059,
  239.     kWindowFloatVertZoomProc    = 1061,
  240.     kWindowFloatVertZoomGrowProc = 1063,
  241.     kWindowFloatHorizZoomProc    = 1065,
  242.     kWindowFloatHorizZoomGrowProc = 1067,
  243.     kWindowFloatFullZoomProc    = 1069,
  244.     kWindowFloatFullZoomGrowProc = 1071
  245. };
  246.  
  247.  
  248. enum {
  249.                                                                 /* Proc IDs for side title bar theme-savvy floating windows */
  250.     kWindowFloatSideProc        = 1073,
  251.     kWindowFloatSideGrowProc    = 1075,
  252.     kWindowFloatSideVertZoomProc = 1077,
  253.     kWindowFloatSideVertZoomGrowProc = 1079,
  254.     kWindowFloatSideHorizZoomProc = 1081,
  255.     kWindowFloatSideHorizZoomGrowProc = 1083,
  256.     kWindowFloatSideFullZoomProc = 1085,
  257.     kWindowFloatSideFullZoomGrowProc = 1087
  258. };
  259.  
  260. /*--------------------------------------------------------------------------------------*/
  261. /* o System 7 Window Positioning Constants                                                */
  262. /*                                                                                        */
  263. /* Passed into StandardAlert and used in 'WIND', 'DLOG', and 'ALRT' templates            */
  264. /* StandardAlert uses zero to specify the default position. Other calls use zero to        */
  265. /* specify "no position".  Do not pass these constants to RepositionWindow.  Do not        */
  266. /* store these constants in the BasicWindowDescription of a 'wind' resource.            */
  267. /*--------------------------------------------------------------------------------------*/
  268.  
  269. enum {
  270.     kWindowNoPosition            = 0x0000,
  271.     kWindowDefaultPosition        = 0x0000,                        /* used by StandardAlert*/
  272.     kWindowCenterMainScreen        = 0x280A,
  273.     kWindowAlertPositionMainScreen = 0x300A,
  274.     kWindowStaggerMainScreen    = 0x380A,
  275.     kWindowCenterParentWindow    = 0xA80A,
  276.     kWindowAlertPositionParentWindow = 0xB00A,
  277.     kWindowStaggerParentWindow    = 0xB80A,
  278.     kWindowCenterParentWindowScreen = 0x680A,
  279.     kWindowAlertPositionParentWindowScreen = 0x700A,
  280.     kWindowStaggerParentWindowScreen = 0x780A
  281. };
  282.  
  283.  
  284. /*--------------------------------------------------------------------------------------*/
  285. /* o Window Positioning Methods                                                            */
  286. /*                                                                                        */
  287. /* Positioning methods passed to RepositionWindow.                                        */
  288. /* Do not use them in WIND, ALRT, DLOG templates.                                          */
  289. /* Do not confuse these constants with the constants above                                */
  290. /*--------------------------------------------------------------------------------------*/
  291.  
  292. typedef UInt32 WindowPositionMethod;
  293. enum {
  294.     kWindowCenterOnMainScreen    = 0x00000001,
  295.     kWindowCenterOnParentWindow    = 0x00000002,
  296.     kWindowCenterOnParentWindowScreen = 0x00000003,
  297.     kWindowCascadeOnMainScreen    = 0x00000004,
  298.     kWindowCascadeOnParentWindow = 0x00000005,
  299.     kWindowCascadeOnParentWindowScreen = 0x00000006,
  300.     kWindowAlertPositionOnMainScreen = 0x00000007,
  301.     kWindowAlertPositionOnParentWindow = 0x00000008,
  302.     kWindowAlertPositionOnParentWindowScreen = 0x00000009
  303. };
  304.  
  305.  
  306. /*--------------------------------------------------------------------------------------*/
  307. /* o GetWindowRegion Types                                                                */
  308. /*--------------------------------------------------------------------------------------*/
  309. typedef UInt16                             WindowRegionCode;
  310. enum {
  311.                                                                 /* Region values to pass into GetWindowRegion & GetWindowBounds */
  312.     kWindowTitleBarRgn            = 0,
  313.     kWindowTitleTextRgn            = 1,
  314.     kWindowCloseBoxRgn            = 2,
  315.     kWindowZoomBoxRgn            = 3,
  316.     kWindowDragRgn                = 5,
  317.     kWindowGrowRgn                = 6,
  318.     kWindowCollapseBoxRgn        = 7,
  319.     kWindowTitleProxyIconRgn    = 8,                            /* Mac OS 8.5 forward*/
  320.     kWindowStructureRgn            = 32,
  321.     kWindowContentRgn            = 33,                            /* Content area of the window; empty when the window is collapsed*/
  322.     kWindowUpdateRgn            = 34,                            /* Carbon forward*/
  323.     kWindowGlobalPortRgn        = 40                            /* Carbon forward - bounds of the window's port in global coordinates; not affected by CollapseWindow*/
  324. };
  325.  
  326. /* GetWindowRegionRec - a pointer to this is passed in WDEF param for kWindowMsgGetRegion*/
  327.  
  328. struct GetWindowRegionRec {
  329.     RgnHandle                         winRgn;
  330.     WindowRegionCode                 regionCode;
  331. };
  332. typedef struct GetWindowRegionRec        GetWindowRegionRec;
  333.  
  334. typedef GetWindowRegionRec *            GetWindowRegionPtr;
  335. typedef GetWindowRegionRec *            GetWindowRegionRecPtr;
  336. /*--------------------------------------------------------------------------------------*/
  337. /* o WDEF Message Types                                                                    */
  338. /*--------------------------------------------------------------------------------------*/
  339. /*
  340.    SetupWindowProxyDragImageRec - setup the proxy icon drag image
  341.    Both regions are allocated and disposed by the Window Manager.
  342.    The GWorld is disposed of by the Window Manager, but the WDEF must allocate
  343.    it.  See Technote on Drag Manager 1.1 additions for more information and sample code for
  344.    setting up drag images.
  345. */
  346.  
  347.  
  348. struct SetupWindowProxyDragImageRec {
  349.     GWorldPtr                         imageGWorld;                /* locked GWorld containing the drag image - output - can be NULL*/
  350.     RgnHandle                         imageRgn;                    /* image clip region, contains the portion of the image which gets blitted to screen - preallocated output - if imageGWorld is NULL, this is ignored*/
  351.     RgnHandle                         outlineRgn;                    /* the outline region used on shallow monitors - preallocated output - must always be non-empty*/
  352. };
  353. typedef struct SetupWindowProxyDragImageRec SetupWindowProxyDragImageRec;
  354. /* MeasureWindowTitleRec - a pointer to this is passed in WDEF param for kWindowMsgMeasureTitle*/
  355.  
  356. struct MeasureWindowTitleRec {
  357.                                                                 /* output parameters (filled in by the WDEF)*/
  358.     SInt16                             fullTitleWidth;                /* text + proxy icon width*/
  359.     SInt16                             titleTextWidth;                /* text width*/
  360. };
  361. typedef struct MeasureWindowTitleRec    MeasureWindowTitleRec;
  362. typedef MeasureWindowTitleRec *            MeasureWindowTitleRecPtr;
  363.  
  364. /*--------------------------------------------------------------------------------------*/
  365. /* o Standard Window Kinds                                                                */
  366. /*--------------------------------------------------------------------------------------*/
  367. enum {
  368.     dialogKind                    = 2,
  369.     userKind                    = 8,
  370.     kDialogWindowKind            = 2,
  371.     kApplicationWindowKind        = 8
  372. };
  373.  
  374.  
  375. /*--------------------------------------------------------------------------------------*/
  376. /* o FindWindow Result Codes                                                            */
  377. /*--------------------------------------------------------------------------------------*/
  378.  
  379. typedef SInt16 WindowPartCode;
  380. enum {
  381.     inDesk                        = 0,
  382.     inNoWindow                    = 0,
  383.     inMenuBar                    = 1,
  384.     inSysWindow                    = 2,
  385.     inContent                    = 3,
  386.     inDrag                        = 4,
  387.     inGrow                        = 5,
  388.     inGoAway                    = 6,
  389.     inZoomIn                    = 7,
  390.     inZoomOut                    = 8,
  391.     inCollapseBox                = 11,                            /* Mac OS 8.0 forward*/
  392.     inProxyIcon                    = 12                            /* Mac OS 8.5 forward*/
  393. };
  394.  
  395.  
  396. /*--------------------------------------------------------------------------------------*/
  397. /* o Window Definition Hit Test Result Codes                                            */
  398. /*--------------------------------------------------------------------------------------*/
  399.  
  400. typedef SInt16 WindowDefPartCode;
  401. enum {
  402.     wNoHit                        = 0,
  403.     wInContent                    = 1,
  404.     wInDrag                        = 2,
  405.     wInGrow                        = 3,
  406.     wInGoAway                    = 4,
  407.     wInZoomIn                    = 5,
  408.     wInZoomOut                    = 6,
  409.     wInCollapseBox                = 9,                            /* Mac OS 8.0 forward*/
  410.     wInProxyIcon                = 10                            /* Mac OS 8.5 forward*/
  411. };
  412.  
  413. /*--------------------------------------------------------------------------------------*/
  414. /* o Window Definition Messages                                                            */
  415. /*--------------------------------------------------------------------------------------*/
  416.  
  417. enum {
  418.     kWindowMsgDraw                = 0,
  419.     kWindowMsgHitTest            = 1,
  420.     kWindowMsgCalculateShape    = 2,
  421.     kWindowMsgInitialize        = 3,
  422.     kWindowMsgCleanUp            = 4,
  423.     kWindowMsgDrawGrowOutline    = 5,
  424.     kWindowMsgDrawGrowBox        = 6
  425. };
  426.  
  427. /* Messages available from Mac OS 8.0 forward*/
  428. enum {
  429.     kWindowMsgGetFeatures        = 7,
  430.     kWindowMsgGetRegion            = 8
  431. };
  432.  
  433. /* Messages available from Mac OS 8.5 forward*/
  434. enum {
  435.     kWindowMsgDragHilite        = 9,                            /* parameter boolean indicating on or off*/
  436.     kWindowMsgModified            = 10,                            /* parameter boolean indicating saved (false) or modified (true)*/
  437.     kWindowMsgDrawInCurrentPort    = 11,                            /* same as kWindowMsgDraw, but must draw in current port*/
  438.     kWindowMsgSetupProxyDragImage = 12,                            /* parameter pointer to SetupWindowProxyDragImageRec*/
  439.     kWindowMsgStateChanged        = 13,                            /* something about the window's state has changed*/
  440.     kWindowMsgMeasureTitle        = 14                            /* measure and return the ideal title width*/
  441. };
  442.  
  443. /* old names*/
  444. enum {
  445.     wDraw                        = 0,
  446.     wHit                        = 1,
  447.     wCalcRgns                    = 2,
  448.     wNew                        = 3,
  449.     wDispose                    = 4,
  450.     wGrow                        = 5,
  451.     wDrawGIcon                    = 6
  452. };
  453.  
  454. /*--------------------------------------------------------------------------------------*/
  455. /* o State-changed Flags for kWindowMsgStateChanged                                     */
  456. /*--------------------------------------------------------------------------------------*/
  457. enum {
  458.     kWindowStateTitleChanged    = (1 << 0)
  459. };
  460.  
  461. /*--------------------------------------------------------------------------------------*/
  462. /* o Window Feature Bits                                                                */
  463. /*--------------------------------------------------------------------------------------*/
  464. enum {
  465.     kWindowCanGrow                = (1 << 0),
  466.     kWindowCanZoom                = (1 << 1),
  467.     kWindowCanCollapse            = (1 << 2),
  468.     kWindowIsModal                = (1 << 3),
  469.     kWindowCanGetWindowRegion    = (1 << 4),
  470.     kWindowIsAlert                = (1 << 5),
  471.     kWindowHasTitleBar            = (1 << 6)
  472. };
  473.  
  474. /* Feature bits available from Mac OS 8.5 forward*/
  475. enum {
  476.     kWindowSupportsDragHilite    = (1 << 7),                        /* window definition supports kWindowMsgDragHilite*/
  477.     kWindowSupportsModifiedBit    = (1 << 8),                        /* window definition supports kWindowMsgModified*/
  478.     kWindowCanDrawInCurrentPort    = (1 << 9),                        /* window definition supports kWindowMsgDrawInCurrentPort*/
  479.     kWindowCanSetupProxyDragImage = (1 << 10),                    /* window definition supports kWindowMsgSetupProxyDragImage*/
  480.     kWindowCanMeasureTitle        = (1 << 11),                    /* window definition supports kWindowMsgMeasureTitle*/
  481.     kWindowWantsDisposeAtProcessDeath = (1 << 12),                /* window definition wants a Dispose message for windows still extant during ExitToShell*/
  482.     kWindowDefSupportsColorGrafPort = 0x40000002                /* window definition does not need the monochrome GrafPort hack during kWindowMsgCalculateShape*/
  483. };
  484.  
  485.  
  486. /*--------------------------------------------------------------------------------------*/
  487. /* o Desktop Pattern Resource ID                                                        */
  488. /*--------------------------------------------------------------------------------------*/
  489. enum {
  490.     deskPatID                    = 16
  491. };
  492.  
  493.  
  494.  
  495. /*--------------------------------------------------------------------------------------*/
  496. /* o Window Color Part Codes                                                            */
  497. /*--------------------------------------------------------------------------------------*/
  498. enum {
  499.     wContentColor                = 0,
  500.     wFrameColor                    = 1,
  501.     wTextColor                    = 2,
  502.     wHiliteColor                = 3,
  503.     wTitleBarColor                = 4
  504. };
  505.  
  506.  
  507. /*--------------------------------------------------------------------------------------*/
  508. /*    o Region Dragging Constants                                                            */
  509. /*--------------------------------------------------------------------------------------*/
  510.  
  511. enum {
  512.     kMouseUpOutOfSlop            = (long)0x80008000
  513. };
  514.  
  515.  
  516. /*--------------------------------------------------------------------------------------*/
  517. /* o Window Color Table                                                                    */
  518. /*--------------------------------------------------------------------------------------*/
  519.  
  520. struct WinCTab {
  521.     long                             wCSeed;                        /* reserved */
  522.     short                             wCReserved;                    /* reserved */
  523.     short                             ctSize;                        /* usually 4 for windows */
  524.     ColorSpec                         ctTable[5];
  525. };
  526. typedef struct WinCTab                    WinCTab;
  527.  
  528. typedef WinCTab *                        WCTabPtr;
  529. typedef WCTabPtr *                        WCTabHandle;
  530. /*--------------------------------------------------------------------------------------*/
  531. /* o WindowRecord                                                                        */
  532. /*--------------------------------------------------------------------------------------*/
  533. #if !OPAQUE_TOOLBOX_STRUCTS
  534. typedef struct WindowRecord             WindowRecord;
  535. typedef WindowRecord *                    WindowPeek;
  536.  
  537. struct WindowRecord {
  538.     GrafPort                         port;
  539.     short                             windowKind;
  540.     Boolean                         visible;
  541.     Boolean                         hilited;
  542.     Boolean                         goAwayFlag;
  543.     Boolean                         spareFlag;
  544.     RgnHandle                         strucRgn;
  545.     RgnHandle                         contRgn;
  546.     RgnHandle                         updateRgn;
  547.     Handle                             windowDefProc;
  548.     Handle                             dataHandle;
  549.     StringHandle                     titleHandle;
  550.     short                             titleWidth;
  551.     Handle                             controlList;
  552.     WindowPeek                         nextWindow;
  553.     PicHandle                         windowPic;
  554.     long                             refCon;
  555. };
  556.  
  557. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  558.  
  559. /*--------------------------------------------------------------------------------------*/
  560. /* o Color WindowRecord                                                                    */
  561. /*--------------------------------------------------------------------------------------*/
  562. #if !OPAQUE_TOOLBOX_STRUCTS
  563. typedef struct CWindowRecord             CWindowRecord;
  564. typedef CWindowRecord *                    CWindowPeek;
  565.  
  566. struct CWindowRecord {
  567.     CGrafPort                         port;
  568.     short                             windowKind;
  569.     Boolean                         visible;
  570.     Boolean                         hilited;
  571.     Boolean                         goAwayFlag;
  572.     Boolean                         spareFlag;
  573.     RgnHandle                         strucRgn;
  574.     RgnHandle                         contRgn;
  575.     RgnHandle                         updateRgn;
  576.     Handle                             windowDefProc;
  577.     Handle                             dataHandle;
  578.     StringHandle                     titleHandle;
  579.     short                             titleWidth;
  580.     Handle                             controlList;
  581.     CWindowPeek                     nextWindow;
  582.     PicHandle                         windowPic;
  583.     long                             refCon;
  584. };
  585.  
  586. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  587.  
  588. /*--------------------------------------------------------------------------------------*/
  589. /* o AuxWinHandle                                                                        */
  590. /*--------------------------------------------------------------------------------------*/
  591. #if !OPAQUE_TOOLBOX_STRUCTS
  592. typedef struct AuxWinRec                 AuxWinRec;
  593. typedef AuxWinRec *                        AuxWinPtr;
  594. typedef AuxWinPtr *                        AuxWinHandle;
  595.  
  596. struct AuxWinRec {
  597.     AuxWinHandle                     awNext;                        /*handle to next AuxWinRec*/
  598.     WindowPtr                         awOwner;                    /*ptr to window */
  599.     CTabHandle                         awCTable;                    /*color table for this window*/
  600.     Handle                             reserved;
  601.     long                             awFlags;                    /*reserved for expansion*/
  602.     CTabHandle                         awReserved;                    /*reserved for expansion*/
  603.     long                             awRefCon;                    /*user Constant*/
  604. };
  605.  
  606. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  607.  
  608. /*--------------------------------------------------------------------------------------*/
  609. /*    o BasicWindowDescription                                                            */
  610. /*                                                                                        */
  611. /*    Contains statically-sized basic attributes of the window, for storage in a            */
  612. /*    collection item.                                                                    */
  613. /*--------------------------------------------------------------------------------------*/
  614. /* constants for the version field*/
  615. enum {
  616.     kWindowDefinitionVersionOne    = 1,
  617.     kWindowDefinitionVersionTwo    = 2
  618. };
  619.  
  620. /* constants for the stateflags bit field */
  621. enum {
  622.     kWindowIsCollapsedState        = (1 << 0L)
  623. };
  624.  
  625.  
  626. struct BasicWindowDescription {
  627.     UInt32                             descriptionSize;            /* sizeof(BasicWindowDescription)*/
  628.  
  629.     Rect                             windowContentRect;            /* location on screen*/
  630.     Rect                             windowZoomRect;                /* location on screen when zoomed out*/
  631.     UInt32                             windowRefCon;                /* the refcon - __avoid saving stale pointers here__    */
  632.     UInt32                             windowStateFlags;            /* window state bit flags*/
  633.     WindowPositionMethod             windowPositionMethod;        /* method last used by RepositionWindow to position the window (if any)*/
  634.  
  635.     UInt32                             windowDefinitionVersion;
  636.     union {
  637.         struct {
  638.             SInt16                             windowDefProc;        /* defProc and variant*/
  639.             Boolean                         windowHasCloseBox;
  640.         }                                 versionOne;
  641.  
  642.         struct {
  643.             WindowClass                     windowClass;        /* the class*/
  644.             WindowAttributes                 windowAttributes;    /* the attributes*/
  645.         }                                 versionTwo;
  646.  
  647.     }                                 windowDefinition;
  648. };
  649. typedef struct BasicWindowDescription    BasicWindowDescription;
  650. /*  the window manager stores the default collection items using these IDs*/
  651. enum {
  652.     kStoredWindowSystemTag        = FOUR_CHAR_CODE('appl'),        /* Only Apple collection items will be of this tag*/
  653.     kStoredBasicWindowDescriptionID = FOUR_CHAR_CODE('sbas'),    /* BasicWindowDescription*/
  654.     kStoredWindowPascalTitleID    = FOUR_CHAR_CODE('s255')        /* pascal title string*/
  655. };
  656.  
  657. /*--------------------------------------------------------------------------------------*/
  658. /* o Window Class Ordering                                                                */
  659. /*                                                                                        */
  660. /*    Special cases for the "behind" parameter in window creation calls.                    */
  661. /*--------------------------------------------------------------------------------------*/
  662. #define kFirstWindowOfClass ((WindowRef)-1L)
  663. #define kLastWindowOfClass ((WindowRef)0L)
  664. /*--------------------------------------------------------------------------------------*/
  665. /* o Zoom Information Handle                                                             */
  666. /*--------------------------------------------------------------------------------------*/
  667.  
  668. struct WStateData {
  669.     Rect                             userState;                    /*user zoom state*/
  670.     Rect                             stdState;                    /*standard zoom state*/
  671. };
  672. typedef struct WStateData                WStateData;
  673. typedef WStateData *                    WStateDataPtr;
  674. typedef WStateDataPtr *                    WStateDataHandle;
  675. /*--------------------------------------------------------------------------------------*/
  676. /* o MixedMode & ProcPtrs                                                                */
  677. /*--------------------------------------------------------------------------------------*/
  678. typedef CALLBACK_API( long , WindowDefProcPtr )(short varCode, WindowRef window, short message, long param);
  679. typedef CALLBACK_API( void , DeskHookProcPtr )(Boolean mouseClick, EventRecord *theEvent);
  680. /*
  681.     WARNING: DeskHookProcPtr uses register based parameters under classic 68k
  682.              and cannot be written in a high-level language without 
  683.              the help of mixed mode or assembly glue.
  684. */
  685. typedef CALLBACK_API( OSStatus , WindowPaintProcPtr )(GDHandle device, GrafPtr qdContext, WindowRef window, RgnHandle inClientPaintRgn, RgnHandle outSystemPaintRgn, void *refCon);
  686. typedef STACK_UPP_TYPE(WindowDefProcPtr)                         WindowDefUPP;
  687. typedef REGISTER_UPP_TYPE(DeskHookProcPtr)                         DeskHookUPP;
  688. typedef STACK_UPP_TYPE(WindowPaintProcPtr)                         WindowPaintUPP;
  689. #if OPAQUE_UPP_TYPES
  690.     EXTERN_API(WindowDefUPP)
  691.     NewWindowDefUPP                   (WindowDefProcPtr        userRoutine);
  692.  
  693.     EXTERN_API(DeskHookUPP)
  694.     NewDeskHookUPP                   (DeskHookProcPtr            userRoutine);
  695.  
  696.     EXTERN_API(WindowPaintUPP)
  697.     NewWindowPaintUPP               (WindowPaintProcPtr        userRoutine);
  698.  
  699.     EXTERN_API(void)
  700.     DisposeWindowDefUPP               (WindowDefUPP            userUPP);
  701.  
  702.     EXTERN_API(void)
  703.     DisposeDeskHookUPP               (DeskHookUPP                userUPP);
  704.  
  705.     EXTERN_API(void)
  706.     DisposeWindowPaintUPP           (WindowPaintUPP            userUPP);
  707.  
  708.     EXTERN_API(long)
  709.     InvokeWindowDefUPP               (short                    varCode,
  710.                                     WindowRef                window,
  711.                                     short                    message,
  712.                                     long                    param,
  713.                                     WindowDefUPP            userUPP);
  714.  
  715.     EXTERN_API(void)
  716.     InvokeDeskHookUPP               (Boolean                    mouseClick,
  717.                                     EventRecord *            theEvent,
  718.                                     DeskHookUPP                userUPP);
  719.  
  720.     EXTERN_API(OSStatus)
  721.     InvokeWindowPaintUPP           (GDHandle                device,
  722.                                     GrafPtr                    qdContext,
  723.                                     WindowRef                window,
  724.                                     RgnHandle                inClientPaintRgn,
  725.                                     RgnHandle                outSystemPaintRgn,
  726.                                     void *                    refCon,
  727.                                     WindowPaintUPP            userUPP);
  728.  
  729. #else
  730.     enum { uppWindowDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  731.     enum { uppDeskHookProcInfo = 0x00130802 };                         /* register no_return_value Func(1_byte:D0, 4_bytes:A0) */
  732.     enum { uppWindowPaintProcInfo = 0x0003FFF0 };                     /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  733.     #define NewWindowDefUPP(userRoutine)                             (WindowDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowDefProcInfo, GetCurrentArchitecture())
  734.     #define NewDeskHookUPP(userRoutine)                             (DeskHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeskHookProcInfo, GetCurrentArchitecture())
  735.     #define NewWindowPaintUPP(userRoutine)                             (WindowPaintUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowPaintProcInfo, GetCurrentArchitecture())
  736.     #define DisposeWindowDefUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  737.     #define DisposeDeskHookUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  738.     #define DisposeWindowPaintUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  739.     #define InvokeWindowDefUPP(varCode, window, message, param, userUPP)  (long)CALL_FOUR_PARAMETER_UPP((userUPP), uppWindowDefProcInfo, (varCode), (window), (message), (param))
  740.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  741.     #pragma parameter InvokeDeskHookUPP(__D0, __A0, __A1)
  742.     void InvokeDeskHookUPP(Boolean mouseClick, EventRecord * theEvent, DeskHookUPP userUPP) = 0x4E91;
  743.     #else
  744.         #define InvokeDeskHookUPP(mouseClick, theEvent, userUPP)         CALL_TWO_PARAMETER_UPP((userUPP), uppDeskHookProcInfo, (mouseClick), (theEvent))
  745.     #endif
  746.     #define InvokeWindowPaintUPP(device, qdContext, window, inClientPaintRgn, outSystemPaintRgn, refCon, userUPP)  (OSStatus)CALL_SIX_PARAMETER_UPP((userUPP), uppWindowPaintProcInfo, (device), (qdContext), (window), (inClientPaintRgn), (outSystemPaintRgn), (refCon))
  747. #endif
  748. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  749. #define NewWindowDefProc(userRoutine)                             NewWindowDefUPP(userRoutine)
  750. #define NewDeskHookProc(userRoutine)                             NewDeskHookUPP(userRoutine)
  751. #define NewWindowPaintProc(userRoutine)                         NewWindowPaintUPP(userRoutine)
  752. #define CallWindowDefProc(userRoutine, varCode, window, message, param) InvokeWindowDefUPP(varCode, window, message, param, userRoutine)
  753. #define CallDeskHookProc(userRoutine, mouseClick, theEvent)        InvokeDeskHookUPP(mouseClick, theEvent, userRoutine)
  754. #define CallWindowPaintProc(userRoutine, device, qdContext, window, inClientPaintRgn, outSystemPaintRgn, refCon) InvokeWindowPaintUPP(device, qdContext, window, inClientPaintRgn, outSystemPaintRgn, refCon, userRoutine)
  755. /*--------------------------------------------------------------------------------------*/
  756. /* o Window Definition Spec.  Used in Carbon to specify the code that defines a window. */
  757. /*--------------------------------------------------------------------------------------*/
  758. enum {
  759.     kWindowDefProcPtr            = 0                                /* raw proc-ptr based access*/
  760. };
  761.  
  762.  
  763. typedef UInt32                             WindowDefType;
  764.  
  765. struct WindowDefSpec {
  766.     WindowDefType                     defType;
  767.     union {
  768.         WindowDefUPP                     defProc;
  769.     }                                 u;
  770. };
  771. typedef struct WindowDefSpec            WindowDefSpec;
  772. /*--------------------------------------------------------------------------------------*/
  773. /* o Window Creation & Persistence                                                        */
  774. /*--------------------------------------------------------------------------------------*/
  775. EXTERN_API( WindowRef )
  776. GetNewCWindow                    (short                     windowID,
  777.                                  void *                    wStorage,
  778.                                  WindowRef                 behind)                                ONEWORDINLINE(0xAA46);
  779.  
  780. EXTERN_API( WindowRef )
  781. NewWindow                        (void *                    wStorage,
  782.                                  const Rect *            boundsRect,
  783.                                  ConstStr255Param         title,
  784.                                  Boolean                 visible,
  785.                                  short                     theProc,
  786.                                  WindowRef                 behind,
  787.                                  Boolean                 goAwayFlag,
  788.                                  long                     refCon)                                ONEWORDINLINE(0xA913);
  789.  
  790. EXTERN_API( WindowRef )
  791. GetNewWindow                    (short                     windowID,
  792.                                  void *                    wStorage,
  793.                                  WindowRef                 behind)                                ONEWORDINLINE(0xA9BD);
  794.  
  795. EXTERN_API( WindowRef )
  796. NewCWindow                        (void *                    wStorage,
  797.                                  const Rect *            boundsRect,
  798.                                  ConstStr255Param         title,
  799.                                  Boolean                 visible,
  800.                                  short                     procID,
  801.                                  WindowRef                 behind,
  802.                                  Boolean                 goAwayFlag,
  803.                                  long                     refCon)                                ONEWORDINLINE(0xAA45);
  804.  
  805. EXTERN_API( void )
  806. DisposeWindow                    (WindowRef                 window)                                ONEWORDINLINE(0xA914);
  807.  
  808. #if TARGET_OS_MAC
  809.     #define MacCloseWindow CloseWindow
  810. #endif
  811. EXTERN_API( void )
  812. MacCloseWindow                    (WindowRef                 window)                                ONEWORDINLINE(0xA92D);
  813.  
  814.  
  815. /*
  816.    Routines available from Mac OS 8.5 forward
  817.    or from Mac OS 8.1 forward when linking to CarbonLib
  818. */
  819.  
  820. EXTERN_API( OSStatus )
  821. CreateNewWindow                    (WindowClass             windowClass,
  822.                                  WindowAttributes         attributes,
  823.                                  const Rect *            contentBounds,
  824.                                  WindowRef *            outWindow);
  825.  
  826. /* Routines available from Mac OS 8.5 forward*/
  827.  
  828. /* Create a window from a 'wind' resource*/
  829. EXTERN_API( OSStatus )
  830. CreateWindowFromResource        (SInt16                 resID,
  831.                                  WindowRef *            outWindow);
  832.  
  833. /* window persistence*/
  834. EXTERN_API( OSStatus )
  835. StoreWindowIntoCollection        (WindowRef                 window,
  836.                                  Collection             collection);
  837.  
  838. EXTERN_API( OSStatus )
  839. CreateWindowFromCollection        (Collection             collection,
  840.                                  WindowRef *            outWindow);
  841.  
  842. /* window refcounting*/
  843. EXTERN_API( OSStatus )
  844. GetWindowOwnerCount                (WindowRef                 window,
  845.                                  UInt32 *                outCount);
  846.  
  847. EXTERN_API( OSStatus )
  848. CloneWindow                        (WindowRef                 window);
  849.  
  850.  
  851. /*--------------------------------------------------------------------------------------*/
  852. /* o Custom Windows                                                                        */
  853. /*--------------------------------------------------------------------------------------*/
  854. /* Routines available from Mac OS 8.1 forward when linking to CarbonLib*/
  855.  
  856. EXTERN_API( OSStatus )
  857. CreateCustomWindow                (const WindowDefSpec *    def,
  858.                                  WindowClass             windowClass,
  859.                                  WindowAttributes         attributes,
  860.                                  const Rect *            contentBounds,
  861.                                  WindowRef *            outWindow);
  862.  
  863. EXTERN_API( OSStatus )
  864. ReshapeCustomWindow                (WindowRef                 window);
  865.  
  866. /*--------------------------------------------------------------------------------------*/
  867. /* o Window Metainformation Accessors                                                    */
  868. /*--------------------------------------------------------------------------------------*/
  869.  
  870. /*
  871.    Routines available from Mac OS 8.5 forward
  872.    or from Mac OS 8.1 forward when linking to CarbonLib
  873. */
  874. EXTERN_API( OSStatus )
  875. GetWindowClass                    (WindowRef                 window,
  876.                                  WindowClass *            outClass);
  877.  
  878. EXTERN_API( OSStatus )
  879. GetWindowAttributes                (WindowRef                 window,
  880.                                  WindowAttributes *        outAttributes);
  881.  
  882. /*
  883.    Routines available from Mac OS 9.0 forward
  884.    or from Mac OS 8.1 forward when linking to CarbonLib
  885. */
  886. EXTERN_API( OSStatus )
  887. ChangeWindowAttributes            (WindowRef                 window,
  888.                                  WindowAttributes         setTheseAttributes,
  889.                                  WindowAttributes         clearTheseAttributes);
  890.  
  891. /*--------------------------------------------------------------------------------------*/
  892. /* o Floating Windows                                                                     */
  893. /*--------------------------------------------------------------------------------------*/
  894. /*
  895.    Routines available from Mac OS 8.6 forward
  896.    or from Mac OS 8.1 forward when linking to CarbonLib
  897. */
  898.  
  899. EXTERN_API( OSStatus )
  900. ShowFloatingWindows                (void);
  901.  
  902. EXTERN_API( OSStatus )
  903. HideFloatingWindows                (void);
  904.  
  905. EXTERN_API( Boolean )
  906. AreFloatingWindowsVisible        (void);
  907.  
  908.  
  909.  
  910. /*--------------------------------------------------------------------------------------*/
  911. /* o Background Image                                                                    */
  912. /*--------------------------------------------------------------------------------------*/
  913. /* SetWinColor is not available in Carbon.*/
  914. EXTERN_API( void )
  915. SetWinColor                        (WindowRef                 window,
  916.                                  WCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA41);
  917.  
  918. /* SetDeskCPat is not available in Carbon.*/
  919. EXTERN_API( void )
  920. SetDeskCPat                        (PixPatHandle             deskPixPat)                            ONEWORDINLINE(0xAA47);
  921.  
  922. /*
  923.    Routines available from Mac OS 8.5 forward
  924.    or from Mac OS 8.1 forward when linking to CarbonLib
  925. */
  926. EXTERN_API( OSStatus )
  927. SetWindowContentColor            (WindowRef                 window,
  928.                                  const RGBColor *        color);
  929.  
  930. EXTERN_API( OSStatus )
  931. GetWindowContentColor            (WindowRef                 window,
  932.                                  RGBColor *                color);
  933.  
  934. /* Routines available from Mac OS 8.5 forward*/
  935. EXTERN_API( OSStatus )
  936. GetWindowContentPattern            (WindowRef                 window,
  937.                                  PixPatHandle             outPixPat);
  938.  
  939. EXTERN_API( OSStatus )
  940. SetWindowContentPattern            (WindowRef                 window,
  941.                                  PixPatHandle             pixPat);
  942.  
  943. /* Routines available from Mac OS 9.0 forward*/
  944.  
  945. typedef OptionBits                         WindowPaintProcOptions;
  946. enum {
  947.     kWindowPaintProcOptionsNone    = 0
  948. };
  949.  
  950. EXTERN_API( OSStatus )
  951. InstallWindowContentPaintProc    (WindowRef                 window,
  952.                                  WindowPaintUPP         paintProc,
  953.                                  WindowPaintProcOptions  options,
  954.                                  void *                    refCon) /* can be NULL */;
  955.  
  956. /*--------------------------------------------------------------------------------------*/
  957. /* o Scrolling Routines                                                                    */
  958. /*--------------------------------------------------------------------------------------*/
  959.  
  960. typedef UInt32 ScrollWindowOptions;
  961. enum {
  962.     kScrollWindowNoOptions        = 0,
  963.     kScrollWindowInvalidate        = (1L << 0),                    /* add the exposed area to the window's update region*/
  964.     kScrollWindowEraseToPortBackground = (1L << 1)                /* erase the exposed area using the background color/pattern of the window's grafport*/
  965. };
  966.  
  967.  
  968. /* Routines available from Mac OS 8.1 forward when linking to CarbonLib*/
  969.  
  970. EXTERN_API( OSStatus )
  971. ScrollWindowRect                (WindowRef                 inWindow,
  972.                                  const Rect *            inScrollRect,
  973.                                  SInt16                 inHPixels,
  974.                                  SInt16                 inVPixels,
  975.                                  ScrollWindowOptions     inOptions,
  976.                                  RgnHandle                 outExposedRgn) /* can be NULL */;
  977.  
  978. EXTERN_API( OSStatus )
  979. ScrollWindowRegion                (WindowRef                 inWindow,
  980.                                  RgnHandle                 inScrollRgn,
  981.                                  SInt16                 inHPixels,
  982.                                  SInt16                 inVPixels,
  983.                                  ScrollWindowOptions     inOptions,
  984.                                  RgnHandle                 outExposedRgn) /* can be NULL */;
  985.  
  986.  
  987.  
  988. /*--------------------------------------------------------------------------------------*/
  989. /* o Low-Level Region & Painting Routines                                                */
  990. /*--------------------------------------------------------------------------------------*/
  991. EXTERN_API( void )
  992. ClipAbove                        (WindowRef                 window)                                ONEWORDINLINE(0xA90B);
  993.  
  994. /* SaveOld/DrawNew are not available in Carbon.  Use ReshapeCustomWindow instead.*/
  995. EXTERN_API( void )
  996. SaveOld                            (WindowRef                 window)                                ONEWORDINLINE(0xA90E);
  997.  
  998. EXTERN_API( void )
  999. DrawNew                            (WindowRef                 window,
  1000.                                  Boolean                 update)                                ONEWORDINLINE(0xA90F);
  1001.  
  1002. EXTERN_API( void )
  1003. PaintOne                        (WindowRef                 window, /* can be NULL */
  1004.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90C);
  1005.  
  1006. EXTERN_API( void )
  1007. PaintBehind                        (WindowRef                 startWindow, /* can be NULL */
  1008.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90D);
  1009.  
  1010. EXTERN_API( void )
  1011. CalcVis                            (WindowRef                 window)                                ONEWORDINLINE(0xA909);
  1012.  
  1013. EXTERN_API( void )
  1014. CalcVisBehind                    (WindowRef                 startWindow, /* can be NULL */
  1015.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90A);
  1016.  
  1017. EXTERN_API( Boolean )
  1018. CheckUpdate                        (EventRecord *            theEvent)                            ONEWORDINLINE(0xA911);
  1019.  
  1020.  
  1021. /*--------------------------------------------------------------------------------------*/
  1022. /* o Window List                                                                        */
  1023. /*--------------------------------------------------------------------------------------*/
  1024. #if TARGET_OS_MAC
  1025.     #define MacFindWindow FindWindow
  1026. #endif
  1027. EXTERN_API( WindowPartCode )
  1028. MacFindWindow                    (Point                     thePoint,
  1029.                                  WindowRef *            window)                                ONEWORDINLINE(0xA92C);
  1030.  
  1031. EXTERN_API( WindowRef )
  1032. FrontWindow                        (void)                                                        ONEWORDINLINE(0xA924);
  1033.  
  1034. EXTERN_API( void )
  1035. BringToFront                    (WindowRef                 window)                                ONEWORDINLINE(0xA920);
  1036.  
  1037. EXTERN_API( void )
  1038. SendBehind                        (WindowRef                 window,
  1039.                                  WindowRef                 behindWindow)                        ONEWORDINLINE(0xA921);
  1040.  
  1041. EXTERN_API( void )
  1042. SelectWindow                    (WindowRef                 window)                                ONEWORDINLINE(0xA91F);
  1043.  
  1044. /*
  1045.    Routines available from Mac OS 8.6 forward
  1046.    or from Mac OS 8.1 forward when linking to CarbonLib
  1047. */
  1048.  
  1049. EXTERN_API( WindowRef )
  1050. FrontNonFloatingWindow            (void);
  1051.  
  1052. /* Routines available from Mac OS 8.1 forward when linking to CarbonLib*/
  1053.  
  1054. EXTERN_API( WindowRef )
  1055. GetNextWindowOfClass            (WindowRef                 inWindow,
  1056.                                  WindowClass             inWindowClass,
  1057.                                  Boolean                 mustBeVisible);
  1058.  
  1059. EXTERN_API( WindowPtr )
  1060. GetFrontWindowOfClass            (WindowClass             inWindowClass,
  1061.                                  Boolean                 mustBeVisible);
  1062.  
  1063. EXTERN_API( OSStatus )
  1064. FindWindowOfClass                (const Point *            where,
  1065.                                  WindowClass             inWindowClass,
  1066.                                  WindowRef *            outWindow,
  1067.                                  SInt16 *                outWindowPart);
  1068.  
  1069.  
  1070. /*--------------------------------------------------------------------------------------*/
  1071. /* o Misc Low-Level stuff                                                                */
  1072. /*--------------------------------------------------------------------------------------*/
  1073. EXTERN_API( void )
  1074. InitWindows                        (void)                                                        ONEWORDINLINE(0xA912);
  1075.  
  1076. /*    The window manager port does not exist in Carbon.    */
  1077. /*    We are investigating replacement technologies.        */
  1078. EXTERN_API( void )
  1079. GetWMgrPort                        (GrafPtr *                wPort)                                ONEWORDINLINE(0xA910);
  1080.  
  1081. EXTERN_API( void )
  1082. GetCWMgrPort                    (CGrafPtr *                wMgrCPort)                            ONEWORDINLINE(0xAA48);
  1083.  
  1084. /*
  1085.    Routines available from Mac OS 8.5 forward
  1086.    or from Mac OS 8.1 forward when linking to CarbonLib
  1087. */
  1088. EXTERN_API( Boolean )
  1089. IsValidWindowPtr                (WindowPtr                 possibleWindow);
  1090.  
  1091. /*
  1092.    Routines available from Mac OS 8.6 forward
  1093.    InitFloatingWindows is not available in Carbon;
  1094.    window ordering is always active for Carbon clients
  1095. */
  1096. EXTERN_API( OSStatus )
  1097. InitFloatingWindows                (void);
  1098.  
  1099.  
  1100. /*--------------------------------------------------------------------------------------*/
  1101. /* o Various & Sundry Window Accessors                                                    */
  1102. /*--------------------------------------------------------------------------------------*/
  1103. EXTERN_API( void )
  1104. HiliteWindow                    (WindowRef                 window,
  1105.                                  Boolean                 fHilite)                            ONEWORDINLINE(0xA91C);
  1106.  
  1107. EXTERN_API( void )
  1108. SetWRefCon                        (WindowRef                 window,
  1109.                                  long                     data)                                ONEWORDINLINE(0xA918);
  1110.  
  1111. EXTERN_API( long )
  1112. GetWRefCon                        (WindowRef                 window)                                ONEWORDINLINE(0xA917);
  1113.  
  1114. EXTERN_API( void )
  1115. SetWindowPic                    (WindowRef                 window,
  1116.                                  PicHandle                 pic)                                ONEWORDINLINE(0xA92E);
  1117.  
  1118. EXTERN_API( PicHandle )
  1119. GetWindowPic                    (WindowRef                 window)                                ONEWORDINLINE(0xA92F);
  1120.  
  1121. EXTERN_API( short )
  1122. GetWVariant                        (WindowRef                 window)                                ONEWORDINLINE(0xA80A);
  1123.  
  1124. /* Routines available from Mac OS 8.0 (Appearance 1.0) forward*/
  1125. EXTERN_API( OSStatus )
  1126. GetWindowFeatures                (WindowRef                 window,
  1127.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA74);
  1128.  
  1129. EXTERN_API( OSStatus )
  1130. GetWindowRegion                    (WindowRef                 window,
  1131.                                  WindowRegionCode         inRegionCode,
  1132.                                  RgnHandle                 ioWinRgn)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA74);
  1133.  
  1134.  
  1135.  
  1136. /*--------------------------------------------------------------------------------------*/
  1137. /* o Update Events                                                                        */
  1138. /*--------------------------------------------------------------------------------------*/
  1139. /*
  1140.    These aren't present in Carbon. Please use the InvalWindowRect, etc. routines
  1141.    below instead.
  1142. */
  1143. EXTERN_API( void )
  1144. InvalRect                        (const Rect *            badRect)                            ONEWORDINLINE(0xA928);
  1145.  
  1146. EXTERN_API( void )
  1147. InvalRgn                        (RgnHandle                 badRgn)                                ONEWORDINLINE(0xA927);
  1148.  
  1149. EXTERN_API( void )
  1150. ValidRect                        (const Rect *            goodRect)                            ONEWORDINLINE(0xA92A);
  1151.  
  1152. EXTERN_API( void )
  1153. ValidRgn                        (RgnHandle                 goodRgn)                            ONEWORDINLINE(0xA929);
  1154.  
  1155. EXTERN_API( void )
  1156. BeginUpdate                        (WindowRef                 window)                                ONEWORDINLINE(0xA922);
  1157.  
  1158. EXTERN_API( void )
  1159. EndUpdate                        (WindowRef                 window)                                ONEWORDINLINE(0xA923);
  1160.  
  1161. /*
  1162.    Routines available from Mac OS 8.5 forward
  1163.    or from Mac OS 8.1 forward when linking to CarbonLib
  1164. */
  1165.  
  1166. EXTERN_API( OSStatus )
  1167. InvalWindowRgn                    (WindowRef                 window,
  1168.                                  RgnHandle                 region);
  1169.  
  1170. EXTERN_API( OSStatus )
  1171. InvalWindowRect                    (WindowRef                 window,
  1172.                                  const Rect *            bounds);
  1173.  
  1174. EXTERN_API( OSStatus )
  1175. ValidWindowRgn                    (WindowRef                 window,
  1176.                                  RgnHandle                 region);
  1177.  
  1178. EXTERN_API( OSStatus )
  1179. ValidWindowRect                    (WindowRef                 window,
  1180.                                  const Rect *            bounds);
  1181.  
  1182.  
  1183. /*--------------------------------------------------------------------------------------*/
  1184. /* o DrawGrowIcon                                                                        */
  1185. /*                                                                                        */
  1186. /*    DrawGrowIcon is deprecated from Mac OS 8.0 forward.  Theme-savvy window defprocs    */
  1187. /*    include the grow box in the window frame.                                            */
  1188. /*--------------------------------------------------------------------------------------*/
  1189. EXTERN_API( void )
  1190. DrawGrowIcon                    (WindowRef                 window)                                ONEWORDINLINE(0xA904);
  1191.  
  1192. /*--------------------------------------------------------------------------------------*/
  1193. /* o Window Titles                                                                        */
  1194. /*--------------------------------------------------------------------------------------*/
  1195. EXTERN_API( void )
  1196. SetWTitle                        (WindowRef                 window,
  1197.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA91A);
  1198.  
  1199. EXTERN_API( void )
  1200. GetWTitle                        (WindowRef                 window,
  1201.                                  Str255                 title)                                ONEWORDINLINE(0xA919);
  1202.  
  1203. /*--------------------------------------------------------------------------------------*/
  1204. /* o Window Proxies                                                                        */
  1205. /*--------------------------------------------------------------------------------------*/
  1206. /*
  1207.    Routines available from Mac OS 8.5 forward
  1208.    or from Mac OS 8.1 forward when linking to CarbonLib
  1209. */
  1210.  
  1211. EXTERN_API( OSStatus )
  1212. SetWindowProxyFSSpec            (WindowRef                 window,
  1213.                                  const FSSpec *            inFile);
  1214.  
  1215. EXTERN_API( OSStatus )
  1216. GetWindowProxyFSSpec            (WindowRef                 window,
  1217.                                  FSSpec *                outFile);
  1218.  
  1219. EXTERN_API( OSStatus )
  1220. SetWindowProxyAlias                (WindowRef                 window,
  1221.                                  AliasHandle             alias);
  1222.  
  1223. EXTERN_API( OSStatus )
  1224. GetWindowProxyAlias                (WindowRef                 window,
  1225.                                  AliasHandle *            alias);
  1226.  
  1227. EXTERN_API( OSStatus )
  1228. SetWindowProxyCreatorAndType    (WindowRef                 window,
  1229.                                  OSType                 fileCreator,
  1230.                                  OSType                 fileType,
  1231.                                  SInt16                 vRefNum);
  1232.  
  1233. EXTERN_API( OSStatus )
  1234. GetWindowProxyIcon                (WindowRef                 window,
  1235.                                  IconRef *                outIcon);
  1236.  
  1237. EXTERN_API( OSStatus )
  1238. SetWindowProxyIcon                (WindowRef                 window,
  1239.                                  IconRef                 icon);
  1240.  
  1241. EXTERN_API( OSStatus )
  1242. RemoveWindowProxy                (WindowRef                 window);
  1243.  
  1244. EXTERN_API( OSStatus )
  1245. BeginWindowProxyDrag            (WindowRef                 window,
  1246.                                  DragReference *        outNewDrag,
  1247.                                  RgnHandle                 outDragOutlineRgn);
  1248.  
  1249. EXTERN_API( OSStatus )
  1250. EndWindowProxyDrag                (WindowRef                 window,
  1251.                                  DragReference             theDrag);
  1252.  
  1253. EXTERN_API( OSStatus )
  1254. TrackWindowProxyFromExistingDrag (WindowRef             window,
  1255.                                  Point                     startPt,
  1256.                                  DragReference             drag,
  1257.                                  RgnHandle                 inDragOutlineRgn);
  1258.  
  1259. EXTERN_API( OSStatus )
  1260. TrackWindowProxyDrag            (WindowRef                 window,
  1261.                                  Point                     startPt);
  1262.  
  1263. EXTERN_API( Boolean )
  1264. IsWindowModified                (WindowRef                 window);
  1265.  
  1266. EXTERN_API( OSStatus )
  1267. SetWindowModified                (WindowRef                 window,
  1268.                                  Boolean                 modified);
  1269.  
  1270. EXTERN_API( Boolean )
  1271. IsWindowPathSelectClick            (WindowRef                 window,
  1272.                                  const EventRecord *    event);
  1273.  
  1274. EXTERN_API( OSStatus )
  1275. WindowPathSelect                (WindowRef                 window,
  1276.                                  MenuHandle             menu, /* can be NULL */
  1277.                                  SInt32 *                outMenuResult);
  1278.  
  1279.  
  1280. /*--------------------------------------------------------------------------------------*/
  1281. /*    o HiliteWindowFrameForDrag                                                            */
  1282. /*                                                                                        */
  1283. /*    If you call ShowDragHilite and HideDragHilite, you don't need to use this routine.    */
  1284. /*    If you implement custom drag hiliting, you should call HiliteWindowFrameForDrag        */
  1285. /*    when the drag is tracking inside a window with drag-hilited content.                */
  1286. /*--------------------------------------------------------------------------------------*/
  1287. /* Routines available from Mac OS 8.5 forward*/
  1288.  
  1289. EXTERN_API( OSStatus )
  1290. HiliteWindowFrameForDrag        (WindowRef                 window,
  1291.                                  Boolean                 hilited)                            TWOWORDINLINE(0x7019, 0xA829);
  1292.  
  1293.  
  1294. /*--------------------------------------------------------------------------------------*/
  1295. /* o Window Transitions                                                                    */
  1296. /*                                                                                         */
  1297. /*     TransitionWindow displays a window with accompanying animation and sound.            */
  1298. /*--------------------------------------------------------------------------------------*/
  1299. /* Routines available from Mac OS 8.5 forward*/
  1300.  
  1301.  
  1302. typedef UInt32 WindowTransitionEffect;
  1303. enum {
  1304.     kWindowZoomTransitionEffect    = 1                                /* Finder-like zoom rectangles, use with Show or Open transition actions*/
  1305. };
  1306.  
  1307.  
  1308. typedef UInt32 WindowTransitionAction;
  1309. enum {
  1310.     kWindowShowTransitionAction    = 1,                            /* param is rect in global coordinates from which to start the animation*/
  1311.     kWindowHideTransitionAction    = 2                                /* param is rect in global coordinates at which to end the animation*/
  1312. };
  1313.  
  1314. EXTERN_API( OSStatus )
  1315. TransitionWindow                (WindowRef                 window,
  1316.                                  WindowTransitionEffect  effect,
  1317.                                  WindowTransitionAction  action,
  1318.                                  const Rect *            rect) /* can be NULL */;
  1319.  
  1320.  
  1321. /*--------------------------------------------------------------------------------------*/
  1322. /* o Window Positioning                                                                    */
  1323. /*--------------------------------------------------------------------------------------*/
  1324.  
  1325. #if TARGET_OS_MAC
  1326.     #define MacMoveWindow MoveWindow
  1327. #endif
  1328. EXTERN_API( void )
  1329. MacMoveWindow                    (WindowRef                 window,
  1330.                                  short                     hGlobal,
  1331.                                  short                     vGlobal,
  1332.                                  Boolean                 front)                                ONEWORDINLINE(0xA91B);
  1333.  
  1334. EXTERN_API( void )
  1335. SizeWindow                        (WindowRef                 window,
  1336.                                  short                     w,
  1337.                                  short                     h,
  1338.                                  Boolean                 fUpdate)                            ONEWORDINLINE(0xA91D);
  1339.  
  1340.  
  1341. /* Note: bBox can only be NULL on Carbon or OS X systems */
  1342. EXTERN_API( long )
  1343. GrowWindow                        (WindowRef                 window,
  1344.                                  Point                     startPt,
  1345.                                  const Rect *            bBox) /* can be NULL */                ONEWORDINLINE(0xA92B);
  1346.  
  1347. /* Note: boundsRect can only be NULL on Carbon or OS X systems */
  1348. EXTERN_API( void )
  1349. DragWindow                        (WindowRef                 window,
  1350.                                  Point                     startPt,
  1351.                                  const Rect *            boundsRect) /* can be NULL */        ONEWORDINLINE(0xA925);
  1352.  
  1353. EXTERN_API( void )
  1354. ZoomWindow                        (WindowRef                 window,
  1355.                                  WindowPartCode         partCode,
  1356.                                  Boolean                 front)                                ONEWORDINLINE(0xA83A);
  1357.  
  1358. /* Routines available from Mac OS 8.0 (Appearance 1.0) forward*/
  1359.  
  1360. EXTERN_API( Boolean )
  1361. IsWindowCollapsable                (WindowRef                 window)                                THREEWORDINLINE(0x303C, 0x000F, 0xAA74);
  1362.  
  1363. EXTERN_API( Boolean )
  1364. IsWindowCollapsed                (WindowRef                 window)                                THREEWORDINLINE(0x303C, 0x0010, 0xAA74);
  1365.  
  1366. EXTERN_API( OSStatus )
  1367. CollapseWindow                    (WindowRef                 window,
  1368.                                  Boolean                 collapse)                            THREEWORDINLINE(0x303C, 0x0011, 0xAA74);
  1369.  
  1370. EXTERN_API( OSStatus )
  1371. CollapseAllWindows                (Boolean                 collapse)                            THREEWORDINLINE(0x303C, 0x0012, 0xAA74);
  1372.  
  1373. /*
  1374.    Routines available from Mac OS 8.5 forward
  1375.    or from Mac OS 8.1 forward when linking to CarbonLib
  1376. */
  1377.  
  1378. EXTERN_API( OSStatus )
  1379. GetWindowBounds                    (WindowRef                 window,
  1380.                                  WindowRegionCode         regionCode,
  1381.                                  Rect *                    globalBounds);
  1382.  
  1383. /* Note: newContentRect can only be NULL on Carbon or OS X systems */
  1384. EXTERN_API( Boolean )
  1385. ResizeWindow                    (WindowRef                 window,
  1386.                                  Point                     startPoint,
  1387.                                  const Rect *            sizeConstraints, /* can be NULL */
  1388.                                  Rect *                    newContentRect) /* can be NULL */;
  1389.  
  1390. /* Routines available from Mac OS 8.5 forward*/
  1391.  
  1392. EXTERN_API( OSStatus )
  1393. SetWindowBounds                    (WindowRef                 window,
  1394.                                  WindowRegionCode         regionCode,
  1395.                                  const Rect *            globalBounds);
  1396.  
  1397. EXTERN_API( OSStatus )
  1398. RepositionWindow                (WindowRef                 window,
  1399.                                  WindowRef                 parentWindow,
  1400.                                  WindowPositionMethod     method);
  1401.  
  1402.  
  1403. EXTERN_API( OSStatus )
  1404. MoveWindowStructure                (WindowRef                 window,
  1405.                                  short                     hGlobal,
  1406.                                  short                     vGlobal);
  1407.  
  1408. EXTERN_API( Boolean )
  1409. IsWindowInStandardState            (WindowRef                 window,
  1410.                                  Point *                idealSize,
  1411.                                  Rect *                    idealStandardState);
  1412.  
  1413. EXTERN_API( OSStatus )
  1414. ZoomWindowIdeal                    (WindowRef                 window,
  1415.                                  SInt16                 partCode,
  1416.                                  Point *                ioIdealSize);
  1417.  
  1418. EXTERN_API( OSStatus )
  1419. GetWindowIdealUserState            (WindowRef                 window,
  1420.                                  Rect *                    userState);
  1421.  
  1422. EXTERN_API( OSStatus )
  1423. SetWindowIdealUserState            (WindowRef                 window,
  1424.                                  Rect *                    userState);
  1425.  
  1426.  
  1427. /*--------------------------------------------------------------------------------------*/
  1428. /* o Window Visibility                                                                    */
  1429. /*--------------------------------------------------------------------------------------*/
  1430.  
  1431. EXTERN_API( void )
  1432. HideWindow                        (WindowRef                 window)                                ONEWORDINLINE(0xA916);
  1433.  
  1434. #if TARGET_OS_MAC
  1435.     #define MacShowWindow ShowWindow
  1436. #endif
  1437. EXTERN_API( void )
  1438. MacShowWindow                    (WindowRef                 window)                                ONEWORDINLINE(0xA915);
  1439.  
  1440. EXTERN_API( void )
  1441. ShowHide                        (WindowRef                 window,
  1442.                                  Boolean                 showFlag)                            ONEWORDINLINE(0xA908);
  1443.  
  1444.  
  1445. /*--------------------------------------------------------------------------------------*/
  1446. /* o Window Properties                                                                    */
  1447. /*--------------------------------------------------------------------------------------*/
  1448. /*
  1449.    Routines available from Mac OS 8.5 forward
  1450.    or from Mac OS 8.1 forward when linking to CarbonLib
  1451. */
  1452.  
  1453. EXTERN_API( OSStatus )
  1454. GetWindowProperty                (WindowRef                 window,
  1455.                                  PropertyCreator         propertyCreator,
  1456.                                  PropertyTag             propertyTag,
  1457.                                  UInt32                 bufferSize,
  1458.                                  UInt32 *                actualSize, /* can be NULL */
  1459.                                  void *                    propertyBuffer);
  1460.  
  1461. EXTERN_API( OSStatus )
  1462. GetWindowPropertySize            (WindowRef                 window,
  1463.                                  PropertyCreator         creator,
  1464.                                  PropertyTag             tag,
  1465.                                  UInt32 *                size);
  1466.  
  1467. EXTERN_API( OSStatus )
  1468. SetWindowProperty                (WindowRef                 window,
  1469.                                  PropertyCreator         propertyCreator,
  1470.                                  PropertyTag             propertyTag,
  1471.                                  UInt32                 propertySize,
  1472.                                  void *                    propertyBuffer);
  1473.  
  1474. EXTERN_API( OSStatus )
  1475. RemoveWindowProperty            (WindowRef                 window,
  1476.                                  PropertyCreator         propertyCreator,
  1477.                                  PropertyTag             propertyTag);
  1478.  
  1479.  
  1480. /* Routines available from Mac OS 8.1 forward when linking to CarbonLib*/
  1481.  
  1482. enum {
  1483.     kWindowPropertyPersistent    = 0x00000001                    /* whether this property gets saved when flattening the window */
  1484. };
  1485.  
  1486. EXTERN_API( OSStatus )
  1487. GetWindowPropertyAttributes        (WindowRef                 window,
  1488.                                  OSType                 propertyCreator,
  1489.                                  OSType                 propertyTag,
  1490.                                  UInt32 *                attributes);
  1491.  
  1492. EXTERN_API( OSStatus )
  1493. ChangeWindowPropertyAttributes    (WindowRef                 window,
  1494.                                  OSType                 propertyCreator,
  1495.                                  OSType                 propertyTag,
  1496.                                  UInt32                 attributesToSet,
  1497.                                  UInt32                 attributesToClear);
  1498.  
  1499. /*--------------------------------------------------------------------------------------*/
  1500. /* o Utilities                                                                            */
  1501. /*--------------------------------------------------------------------------------------*/
  1502. EXTERN_API( long )
  1503. PinRect                            (const Rect *            theRect,
  1504.                                  Point                     thePt)                                ONEWORDINLINE(0xA94E);
  1505.  
  1506.  
  1507. EXTERN_API( RgnHandle )
  1508. GetGrayRgn                        (void)                                                        TWOWORDINLINE(0x2EB8, 0x09EE);
  1509.  
  1510.  
  1511. /*--------------------------------------------------------------------------------------*/
  1512. /* o Window Part Tracking                                                                */
  1513. /*--------------------------------------------------------------------------------------*/
  1514. EXTERN_API( Boolean )
  1515. TrackBox                        (WindowRef                 window,
  1516.                                  Point                     thePt,
  1517.                                  WindowPartCode         partCode)                            ONEWORDINLINE(0xA83B);
  1518.  
  1519. EXTERN_API( Boolean )
  1520. TrackGoAway                        (WindowRef                 window,
  1521.                                  Point                     thePt)                                ONEWORDINLINE(0xA91E);
  1522.  
  1523.  
  1524. /*--------------------------------------------------------------------------------------*/
  1525. /* o Region Dragging                                                                    */
  1526. /*--------------------------------------------------------------------------------------*/
  1527. EXTERN_API( long )
  1528. DragGrayRgn                        (RgnHandle                 theRgn,
  1529.                                  Point                     startPt,
  1530.                                  const Rect *            limitRect,
  1531.                                  const Rect *            slopRect,
  1532.                                  short                     axis,
  1533.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA905);
  1534.  
  1535. EXTERN_API( long )
  1536. DragTheRgn                        (RgnHandle                 theRgn,
  1537.                                  Point                     startPt,
  1538.                                  const Rect *            limitRect,
  1539.                                  const Rect *            slopRect,
  1540.                                  short                     axis,
  1541.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA926);
  1542.  
  1543.  
  1544. /*--------------------------------------------------------------------------------------*/
  1545. /*    o GetAuxWin                                                                            */
  1546. /*                                                                                        */
  1547. /*    GetAuxWin is not available in Carbon                                                */
  1548. /*--------------------------------------------------------------------------------------*/
  1549. #if !OPAQUE_TOOLBOX_STRUCTS
  1550. EXTERN_API( Boolean )
  1551. GetAuxWin                        (WindowRef                 window,
  1552.                                  AuxWinHandle *            awHndl)                                ONEWORDINLINE(0xAA42);
  1553.  
  1554. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  1555.  
  1556. /*--------------------------------------------------------------------------------------*/
  1557. /* o C Glue                                                                                */
  1558. /*--------------------------------------------------------------------------------------*/
  1559. EXTERN_API_C( void )
  1560. setwtitle                        (WindowRef                 window,
  1561.                                  const char *            title);
  1562.  
  1563. EXTERN_API_C( Boolean )
  1564. trackgoaway                        (WindowRef                 window,
  1565.                                  Point *                thePt);
  1566.  
  1567. EXTERN_API_C( short )
  1568. findwindow                        (Point *                thePoint,
  1569.                                  WindowRef *            window);
  1570.  
  1571. EXTERN_API_C( void )
  1572. getwtitle                        (WindowRef                 window,
  1573.                                  char *                    title);
  1574.  
  1575. EXTERN_API_C( long )
  1576. growwindow                        (WindowRef                 window,
  1577.                                  Point *                startPt,
  1578.                                  const Rect *            bBox);
  1579.  
  1580. EXTERN_API_C( WindowRef )
  1581. newwindow                        (void *                    wStorage,
  1582.                                  const Rect *            boundsRect,
  1583.                                  const char *            title,
  1584.                                  Boolean                 visible,
  1585.                                  short                     theProc,
  1586.                                  WindowRef                 behind,
  1587.                                  Boolean                 goAwayFlag,
  1588.                                  long                     refCon);
  1589.  
  1590. EXTERN_API_C( WindowRef )
  1591. newcwindow                        (void *                    wStorage,
  1592.                                  const Rect *            boundsRect,
  1593.                                  const char *            title,
  1594.                                  Boolean                 visible,
  1595.                                  short                     procID,
  1596.                                  WindowRef                 behind,
  1597.                                  Boolean                 goAwayFlag,
  1598.                                  long                     refCon);
  1599.  
  1600. EXTERN_API_C( long )
  1601. pinrect                            (const Rect *            theRect,
  1602.                                  Point *                thePt);
  1603.  
  1604. EXTERN_API_C( Boolean )
  1605. trackbox                        (WindowRef                 window,
  1606.                                  Point *                thePt,
  1607.                                  short                     partCode);
  1608.  
  1609. EXTERN_API_C( long )
  1610. draggrayrgn                        (RgnHandle                 theRgn,
  1611.                                  Point *                startPt,
  1612.                                  const Rect *            boundsRect,
  1613.                                  const Rect *            slopRect,
  1614.                                  short                     axis,
  1615.                                  DragGrayRgnUPP         actionProc);
  1616.  
  1617. EXTERN_API_C( void )
  1618. dragwindow                        (WindowRef                 window,
  1619.                                  Point *                startPt,
  1620.                                  const Rect *            boundsRect);
  1621.  
  1622. /*--------------------------------------------------------------------------------------*/
  1623. /* o WindowRecord Accessors                                                                */
  1624. /*--------------------------------------------------------------------------------------*/
  1625. /*
  1626.     CHAPTER XVI - the Opacity Wars
  1627.     
  1628.     A long, long time ago, in a metaverse far, far away...
  1629.     
  1630.     On an ancient gravestone by the side of the road is a hastily-scrawled
  1631.     epitaph, written in an archaic dialect.  With the help of your robot guide,
  1632.     you translate it:
  1633.  
  1634.     "Shared data structures are difficult/impossible to coordinate in a preemptively
  1635.     multitasking OS.  To allow Apple to provide a fully reentrant toolbox in
  1636.     the future, while still maintaining a reasonable migration path for existing
  1637.     codebases and developer knowledge, the decision has been made to make all
  1638.     toolbox objects opaque."
  1639.     
  1640.     You hear a vague rumbling sound in the distance.  Your guide suggests backing
  1641.     away, but you ignore it, wishing to admire the ornamentation on the gravestone.
  1642.     
  1643.     Not the best decision.  The grave ERUPTS, a dusty maelstrom filling your
  1644.     senses, fragment of dirt and bone flying through the air.  You are thrown
  1645.     violently to the ground, shocked but conscious.
  1646.     
  1647.     The dust clears quickly, revealing a wizened man sitting on the gravestone.
  1648.     He wears a robe and speaks in deep, passionate tones:
  1649.     
  1650.     "N.B. If you attempt to access fields of the WindowRecord, ControlRecord,
  1651.     DialogRecord, or MenuInfo directly in Mac OS X, you _will_ crash.  To avoid
  1652.     this unpleasant situation, please use the accessor macros which correspond to
  1653.     the routines within the ACCESSOR_CALLS_ARE_FUNCTIONS conditional."
  1654.     
  1655.     Yes, this is another change in direction.  But you're sort 'o used to that
  1656.     by now.  And this time, there is no turning back.
  1657. */
  1658. #if !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS
  1659. #ifdef __cplusplus
  1660. inline CGrafPtr        GetWindowPort(WindowRef w)                     { return (CGrafPtr) w;                                                     }
  1661. inline void            SetPortWindowPort(WindowRef w)                { MacSetPort( (GrafPtr) GetWindowPort(w)); }
  1662. inline SInt16        GetWindowKind(WindowRef w)                     { return ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)));             }
  1663. inline void            SetWindowKind(WindowRef    w, SInt16 wKind)    { *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind;              }
  1664. #if TARGET_OS_MAC
  1665. inline Boolean        IsWindowVisible(WindowRef w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  1666. #endif
  1667. inline Boolean        MacIsWindowVisible(WindowRef w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  1668. inline Boolean        IsWindowHilited(WindowRef w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3);        }
  1669. inline Boolean        GetWindowGoAwayFlag(WindowRef w)            { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4);        }
  1670. inline Boolean        GetWindowZoomFlag(WindowRef w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5);        }
  1671. inline void            GetWindowStructureRgn(WindowRef w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), r );    }
  1672. inline void            GetWindowContentRgn(WindowRef w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), r );    }
  1673. inline void            GetWindowUpdateRgn(WindowRef w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), r );    }
  1674. inline SInt16        GetWindowTitleWidth(WindowRef w)                { return *(SInt16 *)(((UInt8 *) w) + sizeof(GrafPort) + 0x1E);            }
  1675. #if TARGET_OS_MAC
  1676. inline WindowRef    GetNextWindow(WindowRef w)                        { return *(WindowRef *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  1677. #endif
  1678. inline WindowRef    MacGetNextWindow(WindowRef w)                    { return *(WindowRef *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  1679.  
  1680. inline void    GetWindowStandardState(WindowRef w, Rect *r)
  1681. {    Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1682. if (stateRects != NULL)    *r = stateRects[1];        }
  1683. inline void    SetWindowStandardState(WindowRef w, const Rect *r)
  1684. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1685.     if (stateRects != NULL)    stateRects[1] = *r;     }
  1686. inline void    GetWindowUserState(WindowRef w, Rect *r)
  1687. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1688.     if (stateRects != NULL)    *r = stateRects[0]; }
  1689. inline void    SetWindowUserState(WindowRef w, const Rect *r)
  1690. { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  1691.     if (stateRects != NULL)    stateRects[0] = *r; }
  1692. inline Handle        GetWindowDataHandle(WindowRef w)                {    return    (((WindowPeek) (w))->dataHandle);                }
  1693. inline void            SetWindowDataHandle(WindowRef w, Handle data)    {    (((WindowPeek) (w))->dataHandle) = ((Handle) (data));    }
  1694. #else
  1695. #if TARGET_OS_MAC
  1696. #define IsWindowVisible MacIsWindowVisible
  1697. #define GetNextWindow MacGetNextWindow
  1698. #endif
  1699. #define ShowHideWindow(w)                        ShowHide(w)
  1700. #define SetPortWindowPort(w)                    MacSetPort( (GrafPtr) GetWindowPort(w) )
  1701. #define GetWindowPort(w)                        ( (CGrafPtr) w)
  1702. #define GetWindowKind(w)                        ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)))
  1703. #define SetWindowKind(w, wKind)                    ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind )
  1704. #define MacIsWindowVisible(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2))
  1705. #define IsWindowHilited(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3))
  1706. #define GetWindowGoAwayFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4))
  1707. #define GetWindowZoomFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5))
  1708. #define GetWindowStructureRgn(w, aRgnHandle)    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), aRgnHandle )
  1709. #define GetWindowContentRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), aRgnHandle )
  1710.  
  1711. #define GetWindowUpdateRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), aRgnHandle )
  1712.  
  1713. #define GetWindowTitleWidth(w)                    ( *(SInt16 *)        (((UInt8 *) w) + sizeof(GrafPort) + 0x1E))
  1714. #define MacGetNextWindow(w)                        ( *(WindowRef *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24))
  1715.  
  1716. #define GetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1717.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[1]; } while (false)
  1718. #define SetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1719.                                                                 if (stateRects != NULL)    stateRects[1] = *aRectPtr; } while (false)
  1720. #define GetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1721.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[0]; } while (false)
  1722. #define SetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1723.                                                                 if (stateRects != NULL)    stateRects[0] = *aRectPtr; } while (false)
  1724. #define GetWindowDataHandle(windowRef)                (((WindowPeek) (windowRef))->dataHandle)
  1725. #define SetWindowDataHandle(windowRef, data)        (((WindowPeek) (windowRef))->dataHandle) = ((Handle) (data))
  1726.  
  1727. #endif  /* defined(__cplusplus) */
  1728.  
  1729. #endif  /* !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS */
  1730.  
  1731. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  1732. /*                                                                                            */
  1733. /*    Direct modification of the close box and zoom box "flags" is not supported in Carbon.    */
  1734. /*                                                                                            */
  1735. /*    GetWindowGoAwayFlag                                                                        */
  1736. /*    GetWindowSpareFlag                                                                        */
  1737. /*    SetWindowGoAwayFlag                                                                        */
  1738. /*    SetWindowSpareFlag                                                                        */
  1739. /*                                                                                            */
  1740. /*    Use GetWindowAttributes and ChangeWindowAttributes if you must dynamically                */
  1741. /*    access the zoom box and close box attributes.                                            */
  1742. /*                                                                                            */
  1743. /* Still available as transitional API in PreCarbon.o, since GetWindowAttributes is not implemented there. */
  1744. EXTERN_API( Boolean )
  1745. GetWindowGoAwayFlag                (WindowRef                 window);
  1746.  
  1747. EXTERN_API( Boolean )
  1748. GetWindowSpareFlag                (WindowRef                 window);
  1749.  
  1750. /* Getters */
  1751. EXTERN_API( WindowRef )
  1752. GetWindowList                    (void);
  1753.  
  1754. EXTERN_API( CGrafPtr )
  1755. GetWindowPort                    (WindowRef                 window);
  1756.  
  1757. EXTERN_API( short )
  1758. GetWindowKind                    (WindowRef                 window);
  1759.  
  1760. #if TARGET_OS_MAC
  1761.     #define MacIsWindowVisible IsWindowVisible
  1762. #endif
  1763. EXTERN_API( Boolean )
  1764. MacIsWindowVisible                (WindowRef                 window);
  1765.  
  1766. EXTERN_API( Boolean )
  1767. IsWindowHilited                    (WindowRef                 window);
  1768.  
  1769. EXTERN_API( Boolean )
  1770. IsWindowUpdatePending            (WindowRef                 window);
  1771.  
  1772. #if TARGET_OS_MAC
  1773.     #define MacGetNextWindow GetNextWindow
  1774. #endif
  1775. EXTERN_API( WindowRef )
  1776. MacGetNextWindow                (WindowRef                 window);
  1777.  
  1778. EXTERN_API( Rect *)
  1779. GetWindowStandardState            (WindowRef                 window,
  1780.                                  Rect *                    rect);
  1781.  
  1782. EXTERN_API( Rect *)
  1783. GetWindowUserState                (WindowRef                 window,
  1784.                                  Rect *                    rect);
  1785.  
  1786. /* Setters */
  1787. EXTERN_API( void )
  1788. SetWindowKind                    (WindowRef                 window,
  1789.                                  short                     kind);
  1790.  
  1791. EXTERN_API( void )
  1792. SetWindowStandardState            (WindowRef                 window,
  1793.                                  const Rect *            rect);
  1794.  
  1795. EXTERN_API( void )
  1796. SetWindowUserState                (WindowRef                 window,
  1797.                                  const Rect *            rect);
  1798.  
  1799. /* Utilities */
  1800. /* set the current QuickDraw port to the port associated with the window */
  1801. EXTERN_API( void )
  1802. SetPortWindowPort                (WindowRef                 window);
  1803.  
  1804. EXTERN_API( Rect *)
  1805. GetWindowPortBounds                (WindowRef                 window,
  1806.                                  Rect *                    bounds);
  1807.  
  1808. /* GetWindowFromPort is needed to 'cast up' to a WindowRef from a GrafPort */
  1809. EXTERN_API( WindowRef )
  1810. GetWindowFromPort                (CGrafPtr                 port);
  1811.  
  1812. /* To prevent upward dependencies, GetDialogFromWindow() is defined in the Dialogs interface: */
  1813. /*        pascal DialogPtr        GetDialogFromWindow(WindowRef window); */
  1814. #endif  /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824. #if PRAGMA_STRUCT_ALIGN
  1825.     #pragma options align=reset
  1826. #elif PRAGMA_STRUCT_PACKPUSH
  1827.     #pragma pack(pop)
  1828. #elif PRAGMA_STRUCT_PACK
  1829.     #pragma pack()
  1830. #endif
  1831.  
  1832. #ifdef PRAGMA_IMPORT_OFF
  1833. #pragma import off
  1834. #elif PRAGMA_IMPORT
  1835. #pragma import reset
  1836. #endif
  1837.  
  1838. #ifdef __cplusplus
  1839. }
  1840. #endif
  1841.  
  1842. #endif /* __MACWINDOWS__ */
  1843.  
  1844.